<template>
    <div class="app-container">
        <signUpDetails :form="form" v-if="proType == '3'" />
        <trailDetails :form="form" v-if="proType == '1'" />
        <declareDetails :form="form" v-if="proType == '2'" />
    </div>
  </template>
  
  <script>
  import signUpDetails from '../components/signUpDetails.vue';
  import trailDetails from '../components/trailDetails.vue';
  import declareDetails from '../components/declareDetails.vue';
  import { getTrailProject, getDeclareProject, getSignProject } from '@/api/project/index';
export default {
  components: {
    declareDetails,
    signUpDetails,
    trailDetails
  },
  name: "projectDetails",
  data() {
    return {
      form: {}
    };
  },
  computed: {
    proType() {
      return this.$route.query.proType;
    },
    viewType() {
      return this.$route.query.viewType;
    },
    proId() {
      return this.$route.query.proId;
    }
  },
  created() {
    if(this.proId) {
      this.getProjectDetails()
    }
  },
  methods: {
    getProjectDetails() {
      let url = this.proType == '1' ? getTrailProject : this.proType == '2' ? getDeclareProject : getSignProject; 
      url(this.proId).then(response => {
        if(response.code == 200) {
          this.form = response.data;
        }
      });
    }
  }
};
</script>
<style scoped lang="scss"></style>